<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "prf_type".
 *
 * @property integer $id
 * @property string $typename
 * @property string $addr
 */
class PrfType extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'prf_type';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['typename'], 'string', 'max' => 26],
            [['addr'], 'string', 'max' => 64],
            [['addr'], 'unique']
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'typename' => 'Typename',
            'addr' => 'Addr',
            'father' => 'Father',
        ];
    }
    public static function getTypeNameById($typeid)
    {
    	return self::findOne(['id'=>$typeid])->typename;
    }
}
